package com.fub.util.database.databaseHelper;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;

public class EdgesDatabaseManager extends SQLiteOpenHelper {
	
	public static final String TABLE_NAME_EDGES = "edges";
	public static final String COL_ID = "_id";
	public static final String BUILDING_ID_COL ="building_id";
	public static final String COL_FROM = "from_id";
	public static final String COL_TO = "to_id";
	private static final String DATABASE_NAME = "edges.db";
	private static final int Version = 2;
	private static final String CREATE_TABLE_EDGES = String
			.format("create table %s (%s  integer primary key autoincrement,%s not null, %s  not null, %s text not null);",
					TABLE_NAME_EDGES, COL_ID, BUILDING_ID_COL, COL_FROM, COL_TO);

	public EdgesDatabaseManager(Context context) {
		super(context, DATABASE_NAME, null, Version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		db.execSQL(CREATE_TABLE_EDGES);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
		db.execSQL("DROP TABLE IF EXISTS " + TABLE_NAME_EDGES);
		onCreate(db);
	}
}
